package com.gobuy.system.filter;

import org.springframework.cloud.gateway.filter.GatewayFilterChain;
import org.springframework.cloud.gateway.filter.GlobalFilter;
import org.springframework.core.Ordered;
import org.springframework.stereotype.Component;
import org.springframework.web.server.ServerWebExchange;
import reactor.core.publisher.Mono;

import java.net.InetSocketAddress;

/**
 * @author Gaozexi on 2020/6/4 9:30
 * Step by Step  and Stand on,  You Are The Best Investment!
 */

/**
 * 获取客户端的url
 * @author GaoZeXi
 */
@Component
public class UrlFilter implements GlobalFilter, Ordered {

    /**
     * 过滤器具体的功能实现,
     * @param exchange
     * @param chain
     * @return
     */
    @Override
    public Mono<Void> filter(ServerWebExchange exchange, GatewayFilterChain chain) {
        //放行
        return chain.filter(exchange);
    }

    /**
     * 过滤器的执行顺序，
     * @return 返回值小的优先执行
     */
    @Override
    public int getOrder() {
        return 2;
    }
}
